package com.yonyou.pmclouds.constructionlog.process;

import com.yonyou.pmclouds.basecom.billstatus.BillStatusConst;
import org.apache.commons.lang3.StringUtils;

import com.yonyou.pmclouds.basecom.bp.processor.SingleProcessor;
import com.yonyou.pmclouds.basecom.consts.BillTypeConst;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.constructionlog.entity.ConstructionLogVO;

public class ConstructionLogBeforeAddProcess implements SingleProcessor<ConstructionLogVO> {

    @Override
    public void process(ConstructionLogVO vo, ConstructionLogVO orig) throws BusinessException {
        if(vo == null) {
            throw new BusinessException("新增施工记录单为空,请检查!");
//        } else if(StringUtils.isEmpty(vo.getPk_constructionunit())) {
//            throw new BusinessException("施工单位为空");
        } else if(StringUtils.isEmpty(vo.getPkProjectpart())) {
            throw new BusinessException("工程部位为空");
        } else if(StringUtils.isEmpty(vo.getPk_inspectstandard())) {
            throw new BusinessException("检查标准为空");
        }
        // 设置单据类型
        vo.setBill_type(BillTypeConst.CONSTRUCTIONLOG_BILLTYPE);
        //状态设置为审批中
        vo.setBillstatus(BillStatusConst.COMMON_FREE_STATUS);
    }

}
